import 'package:flutter/material.dart';
import 'package:go_pet/src/theme/app_colors.dart';
import 'package:story_view/controller/story_controller.dart';
import 'package:story_view/utils.dart';
import 'package:story_view/widgets/story_view.dart';

class Story extends StatelessWidget {
  const Story({super.key});

  @override
  Widget build(BuildContext context) {
    final controller = StoryController();
    List<StoryItem> storyItems = [
      StoryItem.pageImage(
          url:
              'https://sun9-51.userapi.com/impg/hvNAkC0ZJE4tQ6kWHcRmMwWIK0mlj2HC0ASewA/iQSI8e8TM0Q.jpg?size=1075x2160&quality=96&sign=be1200e7c7774c6494173e442b2f1560&type=album',
          controller: controller),
      StoryItem.pageImage(
          url:
              'https://sun108-2.userapi.com/impg/hCT77Skq5LnsFmxfwkPwfwLJW1B2WKta0bOtAQ/hr4TaBp0vmc.jpg?size=1075x2160&quality=96&sign=bb2d5f8af00a43b87efcfc2eb5ee5962&type=album',
          controller: controller),
    ];
    return Container(
      color: AppColors.white,
      child: SafeArea(
        child: StoryView(
            storyItems: storyItems,
            controller: controller, // pass controller here too
            repeat: true, // should the stories be slid forever
            onComplete: () {},
            onVerticalSwipeComplete: (direction) {
              if (direction == Direction.down) {
                Navigator.pop(context);
              }
            } // To disable vertical swipe gestures, ignore this parameter.
            // Preferrably for inline story view.
            ),
      ),
    );
  }
}
